home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 441 / aessrc12 / aesutrc3.s < prev    next >
Text File  |  1990-11-23  |  3KB  |  66 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8. ;*************************************************************************
  9. ;*
  10. ;* AESUTRC3.S - Rectangle utilities 3 of 4.
  11. ;*  Utility routines involving the standard rectangle calcs...
  12. ;*
  13. ;*************************************************************************
  14.  
  15. ;-------------------------------------------------------------------------
  16. ; rc_union
  17. ;-------------------------------------------------------------------------
  18.  
  19. _rc_union::       
  20.           move.l    4(sp),a1 
  21.           move.l    8(sp),a0 
  22.           movem.l   d4-d7,-(sp)
  23.                                         ; Calc right-side x...
  24.           move.w    (a1),d1             ;  rx1 = x1 + w1 
  25.           add.w     4(a1),d1            
  26.           move.w    (a0),d7             ;  rx2 = x2 + w2
  27.           add.w     4(a0),d7            
  28.           cmp.w     d1,d7               ;  compare rx1 <-> rx2
  29.           bge.s     .gotrx              ;  proper rx is the smaller
  30.           move.w    d1,d7               ;  of the two.
  31. .gotrx:   
  32.                                         ; Calc bottom y...
  33.           move.w    2(a1),d1            ;  by1 = y1 + h1
  34.           add.w     6(a1),d1            
  35.           move.w    2(a0),d6            ;  by2 = y2 + h2
  36.           add.w     6(a0),d6            
  37.           cmp.w     d1,d6               ;  compare by1 <-> by2
  38.           bge.s     .gotby              ;  proper by is the smaller
  39.           move.w    d1,d6               ;  of the two.       
  40. .gotby:                                 
  41.                                         ; Calc left-side x...
  42.           move.w    (a0),d5             ;  assume x2
  43.           cmp.w     (a1),d5             ;  compare x1 <-> x2  
  44.           blt.s     .gotlx              ;  proper lx is smaller
  45.           move.w    (a1),d5             ;  of the two.
  46. .gotlx:                                 
  47.                                         ; Calc top y...
  48.           move.w    2(a0),d4            ;  assume y2
  49.           cmp.w     2(a1),d4            ;  compare y1 <-> y2 
  50.           blt.s     .gotty              ;  proper ty is smaller
  51.           move.w    2(a1),d4            ;  of the two.
  52. .gotty:
  53.                                         ; Got all the x/y's...
  54.           move.w    d5,(a0)+            ; store left x
  55.           move.w    d4,(a0)+            ; store top y
  56.           sub.w     d5,d7               ; compute width
  57.           move.w    d7,(a0)+            ; store it
  58.           sub.w     d4,d6               ; compute height
  59.           move.w    d6,(a0)+            ; store it
  60.           movem.l   (sp)+,d4-d7
  61.           tst.w     d0                  ; insure CCR return matches d0.
  62.           rts
  63.  
  64. ;         end of code
  65.  
  66.